import JSONP from '@/interfaces/ajax'
let Jsonp = JSONP.Jsonp
const Search = {
    namespaced: true,
    state() {
        return {
            hot: [],
            association: []
        }
    },
    actions: {
        async getAssociation({ commit }, searchWord) {
            let ret = await Jsonp(config.interface.getSearchAssociate + '.shtml?newVal=' + searchWord)
            commit('fillAssociation', ret.key)
        }
    },
    getters: {

    },
    mutations: {
        fillHotWord: function (state, words) {
            state.hot = words
        },
        fillAssociation: function (state, association) {
            state.association = association
        }
    },
    modules: {

    }
}

export default Search